const { writeYaml } = require("../../lib/files")
const { getProperty, each } = require("../../lib/tools")
const { join } = require('path')

/**
 * 将step1中的内容进行文件缓存，用于开发模式下的调试，并不影响实际执行
 * @param {*} param0 
 */
module.exports = function({config: {globeConfig},step1}){
    const {globe:{model}} = globeConfig
    const distDir = getProperty(globeConfig,g=>g.globe.dist.globe.step1,undefined)
    if(model && 'dev'===model){
        each(step1,(entry,name)=>{
            const dist = join(distDir,`${name}.yaml`)
            if(dist){
                writeYaml(dist,entry)
            }
        })
        
    }
}